//
// Created by bigknife on 14-9-8.
// Copyright (c) 2014 51fmzg. All rights reserved.
//


#import "IDLTableViewCell.h"


@implementation IDLTableViewCell {

}
-(void) willMoveToSuperview:(UIView *)newSuperview {
	[super willMoveToSuperview:newSuperview];
}

- (void)reloadData:(id)data {

}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
	[super touchesBegan:touches withEvent:event];
	if(self.highlightOnTouch){
		[self setHighlighted:YES animated:NO];
	}
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
	[super touchesEnded:touches withEvent:event];
	if(self.highlightOnTouch){
		[self setHighlighted:NO animated:NO];
	}
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
	[super touchesCancelled:touches withEvent:event];
	if(self.highlightOnTouch){
		[self setHighlighted:NO animated:NO];
	}
}

-(void) setDelegate:(id<IDLTableViewCellDelegate>)delegate {
	_delegate = delegate;
	if ([delegate respondsToSelector:@selector(tappedFromCell:)]) {
		UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
		[self addGestureRecognizer:tap];
	}
}

#pragma mark - tap 手势事件
-(void) tapped:(UITapGestureRecognizer *)gesture {
	[self.delegate tappedFromCell:self];
}

@end